let server = require("express")();
let mysql = require("mysql");


//链接mysql
let sql = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: '12345',
    database: 'test'
});
sql.connect();
//查询所有传悦观点列表
server.get("/solutionlist", function(request, response) {
    let solution = request.query.callback
    sql.query("select * from vp_list", function(error, date) {
        if (error) {
            console.log(error)
            response.end(error)
            return;
        }
        let stringdate = JSON.stringify(date);
        response.end(`${solution}(${stringdate})`)
    })
})
server.listen(81)